<template>
    <PageWrapper title="" v-loading="loading">
      <div class="mb-4">
      </div>
      <CollapseContainer title="门店配置">
        <a-tabs default-active-key="projectConfig" v-model:activeKey="currentKey">
            <a-tab-pane key="projectConfig" tab="折扣配置" />
    3
        </a-tabs>
        <div class="pt-4 m-1 desc-wrap" v-if="currentKey == 'projectConfig'">
            <a-card title="" :bordered="false" class="mt-5">
                <WrokConfig  @saveparam="paramSubmit"/>
            </a-card>
        </div>
       
      </CollapseContainer>
    </PageWrapper>
  </template>
  
  <script lang="ts">
    import { ref, defineComponent } from 'vue';
    import { Tabs,Card } from 'ant-design-vue';
    import { PageWrapper } from '/@/components/Page';
    import { CollapseContainer } from '/@/components/Container';
    import { useMessage } from '/@/hooks/web/useMessage';
    import { omit } from 'lodash-es';
    import { BasicForm} from '/@/components/Form';
    import { saveProjectParams } from '/@/api/setParam/setParams'
    import { useI18n } from '/@/hooks/web/useI18n';
    import WrokConfig from './workconfig.vue';
    const { t } = useI18n();
    const { notification } = useMessage();
    export default defineComponent({
      name: 'setSystemParam',
      components: { Tabs, TabPane: Tabs.TabPane, PageWrapper, CollapseContainer, BasicForm,
        [Card.name]: Card,
        [Tabs.name]: Tabs,
        [Tabs.TabPane.name]: Tabs.TabPane,
        WrokConfig
    },
      setup() {
        const currentKey = ref('projectConfig');
        const loading = ref(false);
        
      async function paramSubmit(data) {
        const res = await saveProjectParams(data.value);
        if(res.code == 200){
          notification.success({
                message: t('sys.update.success'),
                description: t('sys.update.success'),
                duration: 3,
              });
        }else{
          notification.error({
                message: t('sys.update.error'),
                description: res.msg,
                duration: 3,
              });
        }
      }
        return {
          omit,
          loading,
          currentKey,
          paramSubmit,
        };
      },
    });
  </script>
  
  <style scoped></style>
  